﻿// ShenTuApp.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include "pch.h"

#include <stdio.h>
#include <iostream>
#include "STInfo.h"
#include "ShowBossToBigMap.h"
#include "boss.h"
#include "GlobalVar.h"
#include "../MemoryRead/CReadMemLib.h"
#include "Player.h"

int liudaolunhui(std::string playname, std::string servername) {
	
	Player  player(servername, playname);
	do
	{
		player.UpdateEx();
		Sleep(200);
	} while (true);
	return 1;
}

typedef int(*callback)(int a,int b);
typedef void(*ShowUiCallBack)(DWORD parent, const char* parentname, DWORD address, char* uiname, POINT pos, POINT relativePos, SIZE size);

int addsum(int a,int b) {
	return a + b;
}

int funcall(int a,int b,callback call) {
	return call(a,b);
}

int Initst(HWND hWnd = 0) {
	//MessageBoxA(0, "Init", 0, 0);
	if (InitSTInfo(hWnd))
	{
		return 1;
	}
	return 0;
}

void ShowGameAllUi(ShowUiCallBack callback) {
	//MessageBoxA(0,"ShowGameAllUi",0,0);
	auto uiroot = CRDWnd2DManager::Get()->GetUIManager_DeskTop();
	if (!uiroot)
	{
		//MessageBoxA(0, "ShowGameAllUi——faild", 0, 0);
		return;
	}
	CRDWnd2DManager::Get()->ShowAllUi(0, { 0,0 }, "", uiroot, callback);
}

void DoWork(const char* configname) {
	MessageBoxA(0, configname, 0, 0);


	do
	{
		OutputDebugStringA("stststst");
		Sleep(100);
	} while (true);
	Player  player;
	do
	{
		player.UpdateEx();
		Sleep(200);
	} while (true);
}

int GetAllObjectFromString(char* str) {
	//MessageBoxA(0, "GetAllObjectFromString", str, 0);
	auto monsterlist = CMainScene::Get()->GetAllObjPos();
	if (monsterlist.size() == 0)
	{
		//MessageBoxA(0, std::to_string(monsterlist.size()).c_str(), "GetAllObjectFromString", 0);
	}
	int count = 1;
	std::string content;
	auto mapname = CMainScene::Get()->GetCurrentMapName();
	for (auto monster : monsterlist) {
		content += std::to_string(monster.info.gtypeid).c_str();//怪物ID
		content += ",";
		content += monster.monsterName.c_str();//怪物名称
		content += "[";//怪物名称
		content += mapname.c_str();//怪物名称
		content += "]";//怪物名称
		content += ",";
		content += std::to_string(monster.info.pos.x) + ":" + std::to_string(monster.info.pos.y);
		content += ",";
		content += std::to_string(monster.blood.blood) + "/" + std::to_string(monster.blood.total);
		content += ",";
		content += std::to_string(monster.point).c_str();//内存地址
		content += "|";
		count++;
	}
	//MessageBoxA(0, content.c_str(), "GetAllObjectFromString", 0);
	strcpy(str,  content.c_str());
	return content.length();
}

BOOL APIENTRY DllMain(HMODULE hModule,
	DWORD  ul_reason_for_call,
	LPVOID lpReserved
)
{
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:
	{
	}
	case DLL_THREAD_ATTACH:
		break;
	case DLL_THREAD_DETACH:
		break;
	case DLL_PROCESS_DETACH:
		break;
	}
	return TRUE;
}



int main()
{
	liudaolunhui("1刀99999999999","征战3区");
	//liudaolunhui("erwtt","龙光13-24区");
	//yuezanst2("1刀99999999999","罪恶之城首区");
	//mulanst("1刀999999999","狂暴首区");
	//heiyuest2("道士如何","战火连天(火爆开启)");
	//daodaost("1刀99999999999","全屏海啸-妖气");
	//yuezanst2("道士如何","记忆2区");
	//daodaost("1刀99999999","苍穹觉醒统战区");
	//daodaost("忠丶","苍穹觉醒统战区");
	//system("pause");
	return 0;
}

